package com.lzd.pojo.response;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor

public class ResponseResult<T> {
    private Integer code;

    private String message;

    private T data;

    public ResponseResult(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data =  data;
    }


    public static ResponseResult success(){

        return new ResponseResult(200,"SUCCESS",null);
    }
    public static ResponseResult success(Object data){

        return new ResponseResult(200,"SUCCESS",data);
    }

    public static ResponseResult error(CommonCode code){

        return new ResponseResult(code.getCode(),code.getMessage(),null);
    }
}
